<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>猎者商城</title>
    <!-- import CSS -->
    <link rel="stylesheet" href="css/eui.css">
    <style>
        body {
            font: 18px "Microsoft YaHei UI";
            margin: 0;
            padding: 0;
            /*vertical-align: center;*/

        }

        header, main, footer {
            margin: 0 !important;
            padding: 0 !important;
        }

        a {
            text-decoration: none;
            color: #333333;
        }

        #header_div1 .el-menu--horizontal > .el-menu-item, #header_div1 .el-menu--horizontal > .el-submenu .el-submenu__title {
            height: 36px;
            line-height: 36px;
        }

        #header_div1 .el-menu-item, #header_div1 .el-submenu__title {
            font-size: 12px;
        }

        .header_span_a {
            margin-right: 20px;
            margin-left: 20px;
            color: white;
            font-size: 12px;
        }

        .el-menu--horizontal > .el-menu-item.is-active {
            border-bottom: white;
        }

        #header_div2 .el-menu--horizontal > .el-menu-item {
            height: 80px;
            line-height: 80px;
        }

        #header_div2 .el-menu-item, #header_div2 .el-submenu__title {
            font-size: 18px;
            padding: 0 40px 0 0;
        }

        #main_div1 .el-submenu__title {
            margin: 30px 0;
            padding: 0 180px 0 30px;
        }

        .el-col-3, .el-menu--collapse {
            border: none;
        }

        #main_div1 p {
            margin: 0;
            position: absolute;
            bottom: 0;
            left: 70px;
        }

        #main_div3 span {
            color: black;
            font-size: 18px;
            position: absolute;
            top: 90px;
            right: 57px;
        }

        .main_title {
            font-size: 30px;
            font-weight: bold;
            margin-left: 40px;
        }
        .span_sale{
            float: right;
        }
        .div_describe{
            font-size: 15px;
        }
        .main_div_img, .main_div_img > img{
            height: 150px;
            width:150px;
            margin: 0 auto;
        }
        .div_describe p{
            margin-bottom: 30px;
        }
    </style>
</head>
<body>
<div id="app">
    <el-container>
        <el-header style="height: 140px;width: 1520px;overflow: hidden">
            <!-- 黑条开始 -->
            <div style="height: 36px; line-height: 36px;background-color: #392f41">
                    <span style="margin-left: 105px">
                        <a class="header_span_a" href="/">首页</a><el-divider direction="vertical"></el-divider>
                        <a class="header_span_a" href="">猎者商城</a><el-divider direction="vertical"></el-divider>
                        <a class="header_span_a" href="">猎者俱乐部</a>
                    </span>
                <div id="header_div1" style="float: right; margin-right: 120px">
                    <el-menu
                            class="el-menu-demo"
                            mode="horizontal"
                            @select="handleSelect"
                            background-color="#392f41"
                            text-color="#fff"
                            active-text-color="#ffd04b">
                        <el-menu-item index="login">请登录</el-menu-item>
                        <el-menu-item index="reg">注册</el-menu-item>
                        <el-menu-item index="myorder">我的订单</el-menu-item>
                        <el-menu-item index="shoppingcart">购物车</el-menu-item>
                        <el-submenu index="5">
                            <template slot="title">客服</template>
                            <el-menu-item index="5-1" style="text-align: center">在线客服</el-menu-item>
                            <el-menu-item index="5-2">
                                <i class="el-icon-phone" style="color: white"></i>电话客服 : 400-000-0000
                            </el-menu-item>
                        </el-submenu>
                    </el-menu>
                </div>
            </div>
            <!-- 黑条结束 -->
            <!-- 白条开始 -->
            <div id="header_div2" style="width: 100%; background-color: white; padding-top: 10px">
                <el-row>
                    <el-col span="2">
                        <div style="height: 80px; background-image: url('imgs/ab.jpg');
                                    background-repeat: no-repeat;
                                    background-size: 80px 80px;
                                    margin-left: 20px"></div>
                    </el-col>
                    <el-col span="22">
                        <el-menu class="el-menu-demo" mode="horizontal" @select="handleSelect"
                                 style="height: 80px; line-height: 80px; border: none"
                                 text-color="black">
                            <el-menu-item index="1">猎者商城</el-menu-item>
                            <el-menu-item index="2">组装神机</el-menu-item>
                            <el-menu-item index="3">机械键盘</el-menu-item>
                            <el-menu-item index="4">竞技鼠标</el-menu-item>
                            <el-menu-item index="5">电竞耳机</el-menu-item>
                            <el-menu-item index="6">必备硬件</el-menu-item>
                            <el-menu-item style="margin-left: 330px" index="-1">
                                <el-input size="small" @keydown.native.enter="search()" v-model="wd"
                                          placeholder="请输入关键字搜索"></el-input>
                            </el-menu-item>
                            <!--position: relative;top: 10px;left: 15px-->
                            <el-button
                                    style="float: right;background-color: rgba(0,0,0,0);border:none; position: relative; top: 24px; right: 195px"
                                    icon="el-icon-search" @click="search()"></el-button>
                        </el-menu>
                    </el-col>
                </el-row>
            </div>
            <!-- 白条结束 -->
        </el-header>
        <el-main style="overflow: hidden">
            <div>
                <el-row style="width: 1520px; margin: 0 auto">
                    <el-col span="3">
                        <div id="main_div1" style="float: left; margin-top: 15px">
                            <el-menu class="el-menu-vertical-demo" collapse="true">
                                <el-submenu index="1">
                                    <template slot="title">
                                        <i class="el-icon-mobile"></i>
                                        <p>组装神机</p>
                                    </template>
                                    <el-menu-item-group>
                                        <span slot="title">官方组装</span>
                                        <el-menu-item index="1-1">性能王者</el-menu-item>
                                        <el-menu-item index="1-2">性价比专区</el-menu-item>
                                        <el-menu-item-group>
                                            <span slot="title">官方组装</span>
                                            <el-menu-item index="1-1">性能王者</el-menu-item>
                                            <el-menu-item index="1-2">性价比专区</el-menu-item>
                                        </el-menu-item-group>
                                    </el-menu-item-group>
                                </el-submenu>
                                <el-submenu index="2">
                                    <template slot="title">
                                        <i class="el-icon-coordinate"></i>
                                        <p>机械键盘
                                        <p>
                                    </template>
                                    <el-menu-item-group>
                                        <span slot="title">官方正品</span>
                                        <el-menu-item index="2-1">达尔优</el-menu-item>
                                        <el-menu-item index="2-2">雷神</el-menu-item>
                                    </el-menu-item-group>
                                </el-submenu>
                                <el-submenu index="3">
                                    <template slot="title">
                                        <i class="el-icon-mouse"></i>
                                        <p>竞技鼠标
                                        <p>
                                    </template>
                                    <el-menu-item-group>
                                        <span slot="title">竞技鼠标</span>
                                        <el-menu-item index="3-1">选项1</el-menu-item>
                                        <el-menu-item index="3-2">选项2</el-menu-item>
                                    </el-menu-item-group>
                                </el-submenu>
                                <el-submenu index="4">
                                    <template slot="title">
                                        <i class="el-icon-service"></i>
                                        <p>电竞耳机
                                        <p>
                                    </template>
                                    <el-menu-item-group>
                                        <span slot="title">组装机</span>
                                        <el-menu-item index="4-1">选项1</el-menu-item>
                                        <el-menu-item index="4-2">选项2</el-menu-item>
                                    </el-menu-item-group>
                                </el-submenu>
                                <el-submenu index="5">
                                    <template slot="title">
                                        <i class="el-icon-cpu"></i>
                                        <p>必备硬件
                                        <p>
                                    </template>
                                    <el-menu-item-group>
                                        <span slot="title">组装机</span>
                                        <el-menu-item index="5-1">选项1</el-menu-item>
                                        <el-menu-item index="5-2">选项2</el-menu-item>
                                    </el-menu-item-group>
                                </el-submenu>
                            </el-menu>
                        </div>
                    </el-col>
                    <el-col span="21">
                        <div id="main_div2">
                            <el-carousel height="500px" style="padding-left: 5px">
                                <el-carousel-item v-for="i in banner">
                                    <img :src="i" alt="" style="width: 100%">
                                </el-carousel-item>
                            </el-carousel>
                        </div>
                    </el-col>
                </el-row>
                <el-card style="background-color:rgba(0, 0, 0, 0);text-align: center; height: 150px; border: none"
                         shadow="never">
                    <div id="main_div3" style="position: relative; display: inline-block">
                        <a href="">
                            <img style="height:48px;width: 48px;margin: 30px 70px 0 70px" src="imgs/44.jpg" alt="">
                            <span>游戏鼠标</span>
                        </a>
                    </div>
                </el-card>
            </div>
            <div style="width: 1200px; margin: 0 auto">
                <h1 class="main_title">爆款推荐</h1>
                <el-row gutter="10">
                    <el-col :span="10">
                        <el-card style="background-color:white">
                            <div>
                                <img src="imgs/61.jpg" alt="" style="height: 306px;width:472px">
                            </div>
                        </el-card>
                    </el-col>
                    <el-col :span="14">
                            <div style="margin-top: 25px">
                                <el-col :span="8" v-for="p in productTArr">
                                    <el-card>
                                        <div class="main_div_img">
                                            <img :src="p.url" alt="">
                                        </div>
                                        <div class="div_describe">
                                            <a href=""><p>{{p.title}}</p></a>
                                            <div>
                                                <span>￥{{p.price}}<small>￥{{p.oldPrice}}</small></span>
                                                <span class="span_sale">销量:{{p.saleCount}}件</span>
                                            </div>
                                        </div>
                                    </el-card>
                                </el-col>
                            </div>
                    </el-col>
                </el-row>
                <div style="margin: 30px 0">
                    <span class="main_title">鼠标</span>
                    <span><a href="">雷蛇</a></span>
                    <span><a href="">戴尔</a></span>
                    <span><a href="">罗技</a></span>
                </div>
                <el-row :gutter="20">
                    <el-col :span="6" v-for="p1 in productSArr">
                        <el-card style="background-color:white">
                            <div class="main_div_img">
                                <img :src="p1.url" alt="">
                            </div>
                            <div class="div_describe">
                                <a href=""><p>{{p1.title}}</p></a>
                                <div>
                                    <span>￥{{p1.price}}<small>￥{{p1.oldPrice}}</small></span>
                                    <span class="span_sale">销量:{{p1.saleCount}}件</span>
                                </div>
                            </div>
                        </el-card>
                    </el-col>
                </el-row>
                <div style="margin: 30px 0">
                    <span class="main_title">键盘</span>
                    <span><a href="">雷蛇</a></span>
                    <span><a href="">戴尔</a></span>
                    <span><a href="">罗技</a></span>
                </div>
                <el-row :gutter="20">
                    <el-col :span="6" v-for="p1 in productSArr">
                        <el-card style="background-color:white">
                            <div class="main_div_img">
                                <img :src="p1.url" alt="">
                            </div>
                            <div class="div_describe">
                                <a href=""><p>{{p1.title}}</p></a>
                                <div>
                                    <span>￥{{p1.price}}<small>￥{{p1.oldPrice}}</small></span>
                                    <span class="span_sale">销量:{{p1.saleCount}}件</span>
                                </div>
                            </div>
                        </el-card>
                    </el-col>
                </el-row>
            </div>
        </el-main>
        <el-footer>Footer</el-footer>
    </el-container>
</div>
</body>
<script src="js/vue.min.js"></script>
<!-- import JavaScript -->
<script src="js/eui.js"></script>
<script src="js/axios.min.js"></script>
<script>
    new Vue({
        el: '#app',
        data: function () {
            return {
                banner: ["imgs/banner1.jpg", "imgs/banner2.jpg", "imgs/banner3.jpg", "imgs/banner4.jpg", "imgs/banner5.jpg"],
                wd: "",
                bannerArr: ["imgs/1.jpg", "imgs/2.jpg", "imgs/3.jpg", "imgs/4.jpg", "imgs/5.jpg", "imgs/6.jpg"],
                bannerArr1: ["imgs/11.jpg", "imgs/12.jpg", "imgs/13.jpg", "imgs/14.jpg"],
                productArr: ["imgs/1.jpg", "imgs/2.jpg", "imgs/3.jpg", "imgs/4.jpg", "imgs/5.jpg", "imgs/6.jpg"],
                categoryArr: [],
                productTArr: [{
                    title: "森马牛仔裤女宽松慢跑裤运动风2022春季新款显瘦束脚长裤复古",
                    price: 233,
                    oldPrice: 598,
                    url: "imgs/63.jpg",
                    saleCount: 2342
                }],
                productSArr: [{
                    title: "森马牛仔裤女宽松慢跑裤运动风2022春季新款显瘦束脚长裤复古",
                    price: 233,
                    oldPrice: 598,
                    url: "imgs/62.jpg",
                    saleCount: 2342
                },]
            }
        },
        methods: {
            search() {
                //跳转到结果页面并且把搜索的关键字传递过去
                location.href = "/result.html?wd=" + v.wd;
            },
            handleSelect(index) {
                console.log(index);
                //传递过来的index 其实就是分类的id
                //跳转到新的页面显示这个分类下的商品信息
                if (index == "login") {//判断出点击的不是搜索框
                    location.href = "/login.html";
                }else if (index == "reg"){
                    location.href = "/reg.html";
                }else if (index == "myorder"){
                    location.href = "/usercommodityorder.html?name="+1;
                }else if (index == "shoppingcart"){
                    location.href = "/usercommodityorder.html?name="+2;
                }else if (index != -1){
                    location.href == "/result.html?cid=" + index;
                }
            }
        },
        created: function () {
            //发请求获取所有的分类信息
            axios.get("/category/select").then(function (response) {
                v.categoryArr = response.data;
            })
            //发请求获取所有轮播图信息
            axios.get("/banner/select").then(function (response) {
                v.bannerArr = response.data;
            })
            //发请求获取所有商品信息
            axios.get("/product/select/index").then(function (response) {
                v.productArr = response.data;
            })
            //发请求获取排行榜数据
            axios.get("/product/select/top").then(function (response) {
                v.topArr = response.data;

            })

        }
    })
</script>
</html>